package com.jiazhong.backend.test;


import com.jiazhong.backend.service.CategoryService;
import com.jiazhong.commons.bean.Category;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.stereotype.Component;

import java.util.List;

@SpringBootTest
@Component
@Slf4j
public class CategoryApp {
    @Resource
    private CategoryService service;

    @Test
    public void a(){
        List<Category> list = service.list();
        list.forEach(System.out::println);
    }

    @Test
    public void b(){
        Category category = new Category();
        category.setName("计算机类");
        category.setSort(13);
        service.save(category);
    }

    @Test
    public void c(){
        Category category = new Category();
        category.setId("1853292001261301762");
        category.setName("哲学类");
        service.updateById(category);
    }

    @Test
    public void d(){
        boolean removeById = service.removeById("1853292001261301762");
        log.info("remove:{}",removeById);
    }
}
